import { ApolloQueryResult, FetchResult, FetchPolicy } from '@apollo/client/core';
import { Observable } from 'rxjs';
/**************************************************************************************
 * 账户管理
 */
/*************************************************************************************
 * 服务接口定义
 */
export interface AccountManagerServiceApi {
  list(variables: AccountManagerService_listVariables, options:AccountManagerServiceQueryOptions): Observable<ApolloQueryResult<AccountManagerService_listResult>>; // 分页查询
  totalCount(): Observable<ApolloQueryResult<AccountManagerService_totalCountResult>>; // 统计库中所有对象的数据量
  search(variables: AccountManagerService_searchVariables, options:AccountManagerServiceQueryOptions): Observable<ApolloQueryResult<AccountManagerService_searchResult>>; // 游标查询
  loadAll(): Observable<ApolloQueryResult<AccountManagerService_loadAllResult>>; // 获取库中所有数据，数据量大时请谨慎使用
  getById(variables: AccountManagerService_getByIdVariables, options:AccountManagerServiceQueryOptions): Observable<ApolloQueryResult<AccountManagerService_getByIdResult>>; // 获取一个对象
  modifyPassword(variables: AccountManagerService_modifyPasswordVariables): Observable<FetchResult<AccountManagerService_modifyPasswordResult>>; // 修改密码
  save(variables: AccountManagerService_saveVariables): Observable<FetchResult<AccountManagerService_saveResult>>; // 保存对象
  removeById(variables: AccountManagerService_removeByIdVariables): Observable<FetchResult<AccountManagerService_removeByIdResult>>; // 删除一个对象
  removeByIdList(variables: AccountManagerService_removeByIdListVariables): Observable<FetchResult<AccountManagerService_removeByIdListResult>>; // 删除一批对象
}
export interface AccountManagerServiceQueryOptions{
  cachePolicy:FetchPolicy;
  more:boolean;
}

/**
 * 分页查询
 */
export interface AccountManagerService_listResult{
    accountManagerService_list: AccountConnection;
}
export interface AccountManagerService_listVariables{
      filter: AccountFilter; // 过滤条件
      orderBy?: AccountOrderBy; // 排序方式
}

/**
 * 统计库中所有对象的数据量
 */
export interface AccountManagerService_totalCountResult{
    accountManagerService_totalCount: number;
}

/**
 * 游标查询
 */
export interface AccountManagerService_searchResult{
    accountManagerService_search: AccountConnection;
}
export interface AccountManagerService_searchVariables{
      first: number; // 获取数据量
      offset: number; // 获取数据起始位置
      filter: AccountFilter; // 过滤条件
      orderBy?: AccountOrderBy; // 排序方式
}

/**
 * 获取库中所有数据，数据量大时请谨慎使用
 */
export interface AccountManagerService_loadAllResult{
    accountManagerService_loadAll: AccountConnection;
}

/**
 * 获取一个对象
 */
export interface AccountManagerService_getByIdResult{
    accountManagerService_getById: AccountPackage;
}
export interface AccountManagerService_getByIdVariables{
      id: string; // 对象的ID值
}


export interface AccountManagerService_modifyPasswordResult{
  accountManagerService_modifyPassword: AccountMutationInfo;
}

/**
 * 修改密码
 */
export interface AccountManagerService_modifyPasswordVariables{
    validPassword: string; // 验证旧密码
    password: string; // 新密码
}

export interface AccountManagerService_saveResult{
  accountManagerService_save: AccountMutationInfo;
}

/**
 * 保存对象
 */
export interface AccountManagerService_saveVariables{
    entity: AccountInput; // 保存对象，无id值新增，有id值修改，如果修改未找到对象则抛出异常修改失败
}

export interface AccountManagerService_removeByIdResult{
  accountManagerService_removeById: AccountMutationInfo;
}

/**
 * 删除一个对象
 */
export interface AccountManagerService_removeByIdVariables{
    id: string; // 对象ID值
}

export interface AccountManagerService_removeByIdListResult{
  accountManagerService_removeByIdList: AccountMutationInfo;
}

/**
 * 删除一批对象
 */
export interface AccountManagerService_removeByIdListVariables{
    ids: string[]; // 对象ID值列表
}
/**
 * 错误信息
 */
export interface AccountErrorBody {
  message: string;
  stackTrace: string;
}

/**
 * 查询结果信息
 */
export interface AccountResultInfo {
  totalCount: number;
  queryTime: number;
  sign: string;
  message: string;
}

/**
 * 分页信息
 */
export interface AccountPageInfo{
  page: number;
  size: number;
  offset: number;
  endCursor: string;
  hasNextPage: boolean;
}

/**
 * 查询集合返回对象
 */
export interface  AccountConnection{
  resultInfo: AccountResultInfo;
  edges: AccountViewEdge[];
  pageInfo: AccountPageInfo;
  uuid: string;
}
export interface AccountViewEdge{
  node:AccountView;
}
/**
 * 查询单个对象返回结果
 */
export interface AccountPackage{
  resultInfo: AccountResultInfo;
  entity: AccountView;
  uuid: string;
}

/**
 * 排序类型
 */
export interface AccountOrderBy {
  field: string;
  type: 'ASC' | 'DESC';
}

/**
 * 更新返回结果信息
 */
export interface AccountMutationInfo {
  status: boolean;
  rows: number;
  messages: string;
  uuid: string;
  sign: string;
  executeTime: number;
  result: AccountView;
}

/**
 * 字符串筛选接口
 */
export interface AccountStringFilter {
  eq?: string;
  neq?: string;
  like?: string;
  in?: string[];
  nin?: string[];
  gt?: string;
  lt?: string;
  gte?: string;
  lte?: string;
}

/**
 * 数字过滤条件接口
 */
export interface AccountNumberFilter {
  eq?: number;
  neq?: number;
  in?: number[];
  nin?: number[];
  gt?: number;
  lt?: number;
  gte?: number;
  lte?: number;
}

/**
 * 布尔类型删选接口
 */
export interface AccountBooleanFilter {
  eq?: boolean;
  neq?: boolean;
}




/*****************************************************************************************
 * 查询接口
 */
export const accountManagerServiceQuery = {
   // 分页查询
  accountManagerService_list: `accountManagerService_list(filter:$filter,orderBy:$orderBy){
    resultInfo{
      totalCount
      queryTime
      sign
      message
    }
    edges{
      node{
      account
      accountTypes
      activated
      tenantId
      tenant
      tenantCode
      tenantName
      creator
      creatorId
      creatorCode
      creatorName
      createDateTime
      lastModifiedDateTime
      sortNum
      id
        }
    }
    pageInfo{
      page
      size
      offset
      hasNextPage
      endCursor
    }
    uuid
  }`
, // 统计库中所有对象的数据量
  accountManagerService_totalCount: `accountManagerService_totalCount`
, // 游标查询
  accountManagerService_search: `accountManagerService_search(first:$first,offset:$offset,filter:$filter,orderBy:$orderBy){
    resultInfo{
      totalCount
      queryTime
      sign
      message
    }
    edges{
      node{
      account
      accountTypes
      activated
      tenantId
      tenant
      tenantCode
      tenantName
      creator
      creatorId
      creatorCode
      creatorName
      createDateTime
      lastModifiedDateTime
      sortNum
      id
        }
    }
    pageInfo{
      page
      size
      offset
      hasNextPage
      endCursor
    }
    uuid
  }`
, // 获取库中所有数据，数据量大时请谨慎使用
  accountManagerService_loadAll: `accountManagerService_loadAll{
    resultInfo{
      totalCount
      queryTime
      sign
      message
    }
    edges{
      node{
      account
      accountTypes
      activated
      tenantId
      tenant
      tenantCode
      tenantName
      creator
      creatorId
      creatorCode
      creatorName
      createDateTime
      lastModifiedDateTime
      sortNum
      id
        }
    }
    pageInfo{
      page
      size
      offset
      hasNextPage
      endCursor
    }
    uuid
  }`
, // 获取一个对象
  accountManagerService_getById: `accountManagerService_getById(id:$id){
    resultInfo{
      totalCount
      queryTime
      sign
      message
    }
    entity{
      account
      accountTypes
      activated
      tenantId
      tenant
      tenantCode
      tenantName
      creator
      creatorId
      creatorCode
      creatorName
      createDateTime
      lastModifiedDateTime
      sortNum
      id
    }
    uuid
  }`
};

/*********************************************************************
 * 更新接口信息
 */
export const accountManagerServiceMutation = {
   // 修改密码
  accountManagerService_modifyPassword: `accountManagerService_modifyPassword(validPassword:$validPassword,password:$password){
    status
    rows
    messages
    uuid
    sign
    executeTime

    errorBody{
      message
      stackTrace
    }
  }`
, // 保存对象
  accountManagerService_save: `accountManagerService_save(entity:$entity){
    status
    rows
    messages
    uuid
    sign
    executeTime
    result{
      account
      accountTypes
      activated
      tenantId
      tenant
      tenantCode
      tenantName
      creator
      creatorId
      creatorCode
      creatorName
      createDateTime
      lastModifiedDateTime
      sortNum
      id
    }
    errorBody{
      message
      stackTrace
    }
  }`
, // 删除一个对象
  accountManagerService_removeById: `accountManagerService_removeById(id:$id){
    status
    rows
    messages
    uuid
    sign
    executeTime

    errorBody{
      message
      stackTrace
    }
  }`
, // 删除一批对象
  accountManagerService_removeByIdList: `accountManagerService_removeByIdList(ids:$ids){
    status
    rows
    messages
    uuid
    sign
    executeTime

    errorBody{
      message
      stackTrace
    }
  }`
};

/************************************************************************
 * 类型信息
 */
/**
 * 登陆账户
 */
export interface AccountStore {
  account?: string; // 账户名称
  accountTypes?: string; // 用户身份
  activated?: boolean; // 是否激活
  tenantId?: string; // 租户ID
  tenant?: string; // 租户快照信息
  tenantCode?: string; // 租户编号
  tenantName?: string; // 租户名称
  creator?: string; // 创建人快照信息
  creatorId?: string; // 创建人ID
  creatorCode?: string; // 创建人账号
  creatorName?: string; // 创建人姓名
  createDateTime?: number; // 创建时间
  lastModifiedDateTime?: number; // 最后修改时间
  sortNum?: number; // 默认排序字段
  id?: number; // 未说明
  [props: string]: any;
}
/**
 * 登陆账户
 */
export interface AccountView {
  account?: string; // 账户名称
  accountTypes?: string; // 用户身份
  activated?: boolean; // 是否激活
  tenantId?: string; // 租户ID
  tenant?: string; // 租户快照信息
  tenantCode?: string; // 租户编号
  tenantName?: string; // 租户名称
  creator?: string; // 创建人快照信息
  creatorId?: string; // 创建人ID
  creatorCode?: string; // 创建人账号
  creatorName?: string; // 创建人姓名
  createDateTime?: number; // 创建时间
  lastModifiedDateTime?: number; // 最后修改时间
  sortNum?: number; // 默认排序字段
  id?: number; // 未说明
  [props: string]: any;
}
/**
 * 登陆账户
 */
export interface AccountInput {
  account?: string; // 账户名称
  accountTypes?: string; // 用户身份
  activated?: boolean; // 是否激活
  tenantId?: string; // 租户ID
  tenant?: string; // 租户快照信息
  tenantCode?: string; // 租户编号
  tenantName?: string; // 租户名称
  creator?: string; // 创建人快照信息
  creatorId?: string; // 创建人ID
  creatorCode?: string; // 创建人账号
  creatorName?: string; // 创建人姓名
  createDateTime?: number; // 创建时间
  lastModifiedDateTime?: number; // 最后修改时间
  sortNum?: number; // 默认排序字段
  id?: number; // 未说明
  [props: string]: any;
}
/**
 * 登陆账户
 */
export interface AccountFilter {
  account?: AccountStringFilter; // 账户名称
  accountTypes?: AccountStringFilter; // 用户身份
  activated?: AccountBooleanFilter; // 是否激活
  tenantId?: AccountStringFilter; // 租户ID
  tenant?: AccountStringFilter; // 租户快照信息
  tenantCode?: AccountStringFilter; // 租户编号
  tenantName?: AccountStringFilter; // 租户名称
  creator?: AccountStringFilter; // 创建人快照信息
  creatorId?: AccountStringFilter; // 创建人ID
  creatorCode?: AccountStringFilter; // 创建人账号
  creatorName?: AccountStringFilter; // 创建人姓名
  createDateTime?: AccountNumberFilter; // 创建时间
  lastModifiedDateTime?: AccountNumberFilter; // 最后修改时间
  sortNum?: AccountNumberFilter; // 默认排序字段
  id?: AccountNumberFilter; // 未说明
  [props: string]: any;
}
